﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using nwrole.toolbox.mailservice.EmailSerialization;

namespace nwrole.toolbox.mailservice
{
    public class MailServiceClient
    {
        private string storageAccount;
        private string largeMessageBlobContainerName;
        private string queueName;

        public MailServiceClient(string storageAccount, string largeMessageBlobContainerName, string queueName)
        {
            this.storageAccount = storageAccount;
            this.largeMessageBlobContainerName = largeMessageBlobContainerName;
            this.queueName = queueName;
        }

        public bool SendMessage(MailMessage msg)
        {
            SerializeableMailMessage serMsg = new SerializeableMailMessage(msg);

            AzureCloudQueueClient client = new AzureCloudQueueClient(storageAccount, largeMessageBlobContainerName, queueName);
            client.EnqueueMessage(serMsg);

            return true;
        }
    }
}
